import request from '@/assets/utils/request'
import type {HotType} from '@/types/good'
import type {AxiosPromise} from 'axios'

// 获取商品详情数据
export let getGoodDetail = (id: string): AxiosPromise => request.get('goods', {id})

// 获取 同类推荐(传id)/猜你喜欢（不传id）
export let getRecommendGoods = (id?: string, limit: number = 16): AxiosPromise =>
  request.get('goods/relevant', {id, limit})

// 获取评论
export let getTake = (goodId: string, params: any): AxiosPromise =>
  request.get(`https://mock.boxuegu.com/mock/1175/goods/${goodId}/evaluate/page`, params)

// 获取评论头部
export let getTakeHead = (goodId: string): AxiosPromise =>
  request.get(`https://mock.boxuegu.com/mock/1175/goods/${goodId}/evaluate`)

// 获取热榜数据
export let getHot = (goodId: string, type: HotType, limit: number = 3): AxiosPromise =>
  request.get('goods/hot', {goodId, type, limit})

// 获取城市数据
export let getCity = (): AxiosPromise => request.get('https://yjy-oss-files.oss-cn-zhangjiakou.aliyuncs.com/tuxian/area.json')